package dmitrygusev.ratings.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Movie {

	private String title;
	private String title2;
	private String source;
	private String year;
	private String code;
	private String url;
	private String commentsCount;
	private String coverPicture;

	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getCommentsCount() {
		return commentsCount;
	}
	public void setCommentsCount(String commentsCount) {
		this.commentsCount = commentsCount;
	}
	public String getCoverPicture() {
		return coverPicture;
	}
	public void setCoverPicture(String coverPicture) {
		this.coverPicture = coverPicture;
	}
	private List<Rating> ratings = new ArrayList<Rating>();

	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
	public List<Rating> getRatings() {
		return Collections.unmodifiableList(ratings);
	}
	public void addRating(Rating rating) {
		this.ratings.add(rating);
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public void setTitle2(String title2) {
		this.title2 = title2;
	}
	public String getTitle2() {
		return title2;
	}
	public boolean isTitle2Available() {
		return getTitle2() != null && 
		     ! getTitle2().isEmpty() && 
		     ! getTitle().equals(getTitle2());
	}
}
